<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test4</title>
</head>
<body>
</body>
<script>
    //1.创建数组
    let array1 = new Array();
    console.log(typeof(array1));//object
    array1 = "比特";
    console.log(typeof(array1));//string
    let array2 = [1,2,3,"A","B","C"];
    //2.获取数组元素
    console.log(array2);
    console.log(array2[2]);
    console.log(array2[100]);//undefined
    //3.新增数组元素
    let array3 = [1,2,3,4];
    array3.length = 10;
    console.log(array3);
    array3[8] = 9;
    console.log(array3);
    let array4 = [];
    for(let i = 0;i < 10;i++){
        array4.push(array3[i]);
    }
    console.log(array4);
    //4.删除数组元素 
    let array5 = ['a','b','c','d'];
    array5.splice(0,1);//从0下标开始,删除一个元素
    console.log(array5);
</script>
</html>